package Z10InteerBian.Sockednlink.LinkTestString;


import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.ServerSocket;
import java.net.Socket;

/**
 * @author 李某
 * * @date 2021/10/21
 * *物有本末，事有终始。知其先后者，则近道矣！
 * *荷花开满池塘的前一天还是半塘荷花半塘云。
 */
public class Server {
    public static void main(String[] args) {

        try {

            ServerSocket ss = new ServerSocket(8888);
            System.out.println("监听8888端口号");
            Socket s = ss.accept();

            InputStream is = s.getInputStream();

            DataInputStream dis = new DataInputStream(is);

            String msg = dis.readUTF();
            System.out.println(msg);
            dis.close();
            s.close();
            ss.close();
            System.out.println("端口关闭");
        }catch (IOException e){
            e.printStackTrace();
        }

        }
}
